package collection

func Reduce(array []T, iteratee func(sum V, value T, index int, array []T) V, accumulator V) V {
	for index, value := range array {
		accumulator = iteratee(accumulator, value, index, array)
	}
	return accumulator
}
